﻿using System.Collections.Generic;
using Myotragus.Data.Domain;
using NHibernate.Criterion;

namespace Myotragus.Data
{
  public interface ILocalizableRepository<TId, TEntity> : IRepository<TEntity>
    where TEntity : class, IEntity<TId>
  {
    bool Exists(TId id);
    TEntity Load(int lcId, TId id);

    void Delete(IEnumerable<TEntity> objs);
    void Delete(params TEntity[] objs);

    IEnumerable<TEntity> FindAll(int lcId, params Order[] orderBy);
    IEnumerable<TEntity> FindAll(int lcId, int firstResult, 
      int maxResults, params Order[] orderBy);

    int Count();

    IEnumerable<TEntity> FindMatching(int lcId, object pattern, params Order[] orderBy);
    IEnumerable<TEntity> FindMatching(int lcId, object pattern, int firstResult, 
      int maxResults, params Order[] orderBy);

    int CountMatching(int lcId, object pattern);

    void Save(int lcId, IEnumerable<TEntity> objs);
    void Save(int lcId, params TEntity[] objs);
    bool Exists(int lcId, TId id);
    IEnumerable<TEntity> FindLike(int lcId, object pattern, params Order[] orderBy);

    IEnumerable<TEntity> FindLike(int lcId, object pattern, int firstResult,
      int maxResults, params Order[] orderBy);

    int CountLike(int lcId, object pattern);
  }
}